<?php
class just4u extends MY_Controller{
	
	private $title,$member = "7a07f11cfd128fcaaa8173ff1e6855fc";
	
	function __construct(){
		parent::__construct();
		$this->config->load("raw");
	}
	
	function index(){
		$this->news();
	}
	
	function edisi(){
		$this->title = "Edisi";
		$code = $this->uri->segment(3,0);
		if($code==""){
			$code = "";
		}
		/*
		 * load header
		 */
		$header = $this->config->item("header");
		$header = $this->load->view("dashboard/admin/finalizeView/header",$header,true);
		
		/*
		 * load content
		 */
		$content = $this->config->item("content");
		$content['title'] = $this->title." ".$code;
		$content['w_lpanel'] = "10%";
		$content['w_main'] = "80%";
		$content['w_lpanel_main'] = "100%";
		$content['w_rpanel_main'] = "0%";
		$query = array(
					'title'=>$content['title'],
				);
		$content['lpanel'] = $this->load->view('dashboard/admin/content/lpanel','',true);
		$content['main'] = $this->load->view('dashboard/admin/content/edisi/main',$query,true);
		$content['lpanel_main'] = $this->load->view('dashboard/admin/content/edisi/act/home','',true);
//		$content['rpanel_main'] = $this->load->view('dashboard/admin/content/edisi/act','',true);
		$content['bottom'] = $this->load->view('dashboard/admin/content/edisi/bottom',$query,true);
		$content = $this->load->view("dashboard/admin/finalizeView/content",$content,true);
		
		/*
		 * load footer
		 */
		$footer = $this->config->item("footer");
		$footer = $this->load->view("dashboard/admin/finalizeView/footer",$footer,true);
		
		/*
		 * finalize view
		 */
		$jscript = array('gray');
		$css = array('pages','table');
		$page = $this->config->item("page");
		$page['title'] = $page['title']." - ".$this->title;
		$this->finalizeViewAdmin(array(
			'title'=>$page['title'],
			'jscript_add'=>js_script($jscript),
			'css_add'=>css_script($css),
    		'jscript'=>js_script($page['jscript_default']),
    		'css'=>css_script($page['css_default']),
			'header'=>$header,
    		'content'=>$content,
			'footer'=>$footer,
			'layout_width'=>950,
			
		));
	}
	
	function content_edisi(){
		$this->load->model('edisiMod');
		$this->title = "Edisi";
		$code = $this->uri->segment(3,0);
		$menu = $this->uri->segment(4,0);
		/*
		 * load header
		 */
		$header = $this->config->item("header");
		$header = $this->load->view("dashboard/admin/finalizeView/header",$header,true);
		
		/*
		 * load content
		 */
		switch($menu){
			case "sajian-utama" : $menu="Sajian Utama";break;
			case "review-web" 	: $menu="Review Web";break;
			case "internet" 	: $menu="Internet";break;
			case "linux" 		: $menu="Linux";break;
			case "aplikasi" 	: $menu="Aplikasi";break;
			case "hardware" 	: $menu="Hardware";break;
			case "games"	 	: $menu="Games";break;
			case "tips-n-trik" 	: $menu="Tips n' Trik";break;
			case "android" 		: $menu="Android";break;
			
		}
		$content = $this->config->item("content");
		$content['title'] = $this->title." ".$code." ".$menu;
		$content['w_lpanel'] = "10%";
		$content['w_main'] = "80%";
		$content['w_lpanel_main'] = "100%";
		$content['w_rpanel_main'] = "0%";
		$where = array('ke'=>$code);
		$query = array(
					'title'=>$content['title'],
					'query'=>$this->edisiMod->get_where($where,0)
				);
		$content['lpanel'] = $this->load->view('dashboard/admin/content/lpanel','',true);
		$content['main'] = $this->load->view('dashboard/admin/content/edisi/main_content',$query,true);
		$content['lpanel_main'] = $this->load->view('dashboard/admin/content/edisi/act/content_edisi',$query,true);
//		$content['rpanel_main'] = $this->load->view('dashboard/admin/content/edisi/act','',true);
		$content['bottom'] = $this->load->view('dashboard/admin/content/edisi/bottom_content',$query,true);
		$content = $this->load->view("dashboard/admin/finalizeView/content",$content,true);
		
		/*
		 * load footer
		 */
		$footer = $this->config->item("footer");
		$footer = $this->load->view("dashboard/admin/finalizeView/footer",$footer,true);
		
		/*
		 * finalize view
		 */
		$jscript = array('gray');
		$css = array('pages','table');
		$page = $this->config->item("page");
		$page['title'] = $page['title']." - ".$this->title;
		$this->finalizeViewAdmin(array(
			'title'=>$page['title'],
			'jscript_add'=>js_script($jscript),
			'css_add'=>css_script($css),
    		'jscript'=>js_script($page['jscript_default']),
    		'css'=>css_script($page['css_default']),
			'header'=>$header,
    		'content'=>$content,
			'footer'=>$footer,
			'layout_width'=>950,
			
		));
	}
	
	function content_album(){
		$this->load->model('albumMod');
		$this->load->model('imagesMod');
		$this->title = "Album";
		$code = $this->uri->segment(3,0);
		/*
		 * load header
		 */
		$header = $this->config->item("header");
		$header = $this->load->view("dashboard/admin/finalizeView/header",$header,true);
		
		/*
		 * load content
		 */
			$q = $this->db->query("select name from album where id_album='$code' limit 1");
			foreach ($q->result() as $re){
					$code = $re->name;
			}
				
		$content = $this->config->item("content");
		$content['title'] = $this->title." ".$code;
		$content['w_lpanel'] = "10%";
		$content['w_main'] = "80%";
		$content['w_lpanel_main'] = "100%";
		$content['w_rpanel_main'] = "0%";
		$where = array('album'=>$code);
		$query = array(
					'title'=>$content['title'],
					'query'=>$this->imagesMod->get_where($code)
				);
		$content['lpanel'] = $this->load->view('dashboard/admin/content/lpanel','',true);
		$content['main'] = $this->load->view('dashboard/admin/content/album/main_content',$query,true);
		$content['lpanel_main'] = $this->load->view('dashboard/admin/content/album/act/content_edisi',$query,true);
//		$content['rpanel_main'] = $this->load->view('dashboard/admin/content/edisi/act','',true);
		$content['bottom'] = $this->load->view('dashboard/admin/content/album/bottom_content',$query,true);
		$content = $this->load->view("dashboard/admin/finalizeView/content",$content,true);
		
		/*
		 * load footer
		 */
		$footer = $this->config->item("footer");
		$footer = $this->load->view("dashboard/admin/finalizeView/footer",$footer,true);
		
		/*
		 * finalize view
		 */
		$jscript = array('LightFace','LightFace.Request');
		$css = array('pages','table','LightFace');
		$page = $this->config->item("page");
		$page['title'] = $page['title']." - ".$this->title;
		$this->finalizeViewAdmin(array(
			'title'=>$page['title'],
			'jscript_add'=>js_script($jscript),
			'css_add'=>css_script($css),
    		'jscript'=>js_script($page['jscript_default']),
    		'css'=>css_script($page['css_default']),
			'header'=>$header,
    		'content'=>$content,
			'footer'=>$footer,
			'layout_width'=>950,
			
		));
	}
	
	function news(){
		$this->title = "News";
		/*
		 * load header
		 */
		$header = $this->config->item("header");
		$header = $this->load->view("dashboard/admin/finalizeView/header",$header,true);
		
		/*
		 * load content
		 */
		$content = $this->config->item("content");
		$content['title'] = $this->title;
		$content['w_lpanel'] = "10%";
		$content['w_main'] = "80%";
		$content['w_lpanel_main'] = "100%";
		$content['w_rpanel_main'] = "0%";
		$query = array(
					'title'=>$content['title'],
				);
		$content['lpanel'] = $this->load->view('dashboard/admin/content/lpanel','',true);
		$content['main'] = $this->load->view('dashboard/admin/content/news/main',$query,true);
		$content['lpanel_main'] = $this->load->view('dashboard/admin/content/news/act/home','',true);
//		$content['rpanel_main'] = $this->load->view('dashboard/admin/content/news/act','',true);
		$content['bottom'] = $this->load->view('dashboard/admin/content/news/bottom',$query,true);
		$content = $this->load->view("dashboard/admin/finalizeView/content",$content,true);
		
		/*
		 * load footer
		 */
		$footer = $this->config->item("footer");
		$footer = $this->load->view("dashboard/admin/finalizeView/footer",$footer,true);
		
		/*
		 * finalize view
		 */
		$jscript = array('LightFace','LightFace.Request');
		$css = array('pages','table','LightFace');
		$page = $this->config->item("page");
		$page['title'] = $page['title']." - ".$this->title;
		$this->finalizeViewAdmin(array(
			'title'=>$page['title'],
			'jscript_add'=>js_script($jscript),
			'css_add'=>css_script($css),
    		'jscript'=>js_script($page['jscript_default']),
    		'css'=>css_script($page['css_default']),
			'header'=>$header,
    		'content'=>$content,
			'footer'=>$footer,
			'layout_width'=>950,
			
		));
	}
	
	function event(){
		$this->title = "Event";
		/*
		 * load header
		 */
		$header = $this->config->item("header");
		$header = $this->load->view("dashboard/admin/finalizeView/header",$header,true);
		
		/*
		 * load content
		 */
		$content = $this->config->item("content");
		$content['title'] = $this->title;
		$content['w_lpanel'] = "10%";
		$content['w_main'] = "80%";
		$content['w_lpanel_main'] = "100%";
		$content['w_rpanel_main'] = "0%";
		$query = array(
					'title'=>$content['title'],
				);
		$content['lpanel'] = $this->load->view('dashboard/admin/content/lpanel','',true);
		$content['main'] = $this->load->view('dashboard/admin/content/event/main',$query,true);
		$content['lpanel_main'] = $this->load->view('dashboard/admin/content/event/act/home','',true);
//		$content['rpanel_main'] = $this->load->view('dashboard/admin/content/news/act','',true);
		$content['bottom'] = $this->load->view('dashboard/admin/content/event/bottom',$query,true);
		$content = $this->load->view("dashboard/admin/finalizeView/content",$content,true);
		
		/*
		 * load footer
		 */
		$footer = $this->config->item("footer");
		$footer = $this->load->view("dashboard/admin/finalizeView/footer",$footer,true);
		
		/*
		 * finalize view
		 */
		$jscript = array('LightFace','LightFace.Request');
		$css = array('pages','table','LightFace');
		$page = $this->config->item("page");
		$page['title'] = $page['title']." - ".$this->title;
		$this->finalizeViewAdmin(array(
			'title'=>$page['title'],
			'jscript_add'=>js_script($jscript),
			'css_add'=>css_script($css),
    		'jscript'=>js_script($page['jscript_default']),
    		'css'=>css_script($page['css_default']),
			'header'=>$header,
    		'content'=>$content,
			'footer'=>$footer,
			'layout_width'=>950,
			
		));
	}
	
	function help(){
		$this->title = "Help";
		/*
		 * load header
		 */
		$header = $this->config->item("header");
		$header = $this->load->view("dashboard/admin/finalizeView/header",$header,true);
		
		/*
		 * load content
		 */
		$content = $this->config->item("content");
		$content['title'] = $this->title;
		$content['w_lpanel'] = "10%";
		$content['w_main'] = "80%";
		$content['w_lpanel_main'] = "100%";
		$content['w_rpanel_main'] = "0%";
		$query = array(
					'title'=>$content['title'],
				);
		$content['lpanel'] = $this->load->view('dashboard/admin/content/lpanel','',true);
		$content['main'] = $this->load->view('dashboard/admin/content/help/main',$query,true);
		$content['lpanel_main'] = $this->load->view('dashboard/admin/content/help/act/home','',true);
//		$content['rpanel_main'] = $this->load->view('dashboard/admin/content/help/act','',true);
		$content['bottom'] = $this->load->view('dashboard/admin/content/event/bottom',$query,true);
		$content = $this->load->view("dashboard/admin/finalizeView/content",$content,true);
		
		/*
		 * load footer
		 */
		$footer = $this->config->item("footer");
		$footer = $this->load->view("dashboard/admin/finalizeView/footer",$footer,true);
		
		/*
		 * finalize view
		 */
		$jscript = array('LightFace','LightFace.Request');
		$css = array('pages','table','LightFace');
		$page = $this->config->item("page");
		$page['title'] = $page['title']." - ".$this->title;
		$this->finalizeViewAdmin(array(
			'title'=>$page['title'],
			'jscript_add'=>js_script($jscript),
			'css_add'=>css_script($css),
    		'jscript'=>js_script($page['jscript_default']),
    		'css'=>css_script($page['css_default']),
			'header'=>$header,
    		'content'=>$content,
			'footer'=>$footer,
			'layout_width'=>950,
			
		));
	}
	
	function album(){
		$this->title = "Album";
		/*
		 * load header
		 */
		$header = $this->config->item("header");
		$header = $this->load->view("dashboard/admin/finalizeView/header",$header,true);
		
		/*
		 * load content
		 */
		$content = $this->config->item("content");
		$content['title'] = $this->title;
		$content['w_lpanel'] = "10%";
		$content['w_main'] = "80%";
		$content['w_lpanel_main'] = "100%";
		$content['w_rpanel_main'] = "0%";
		$query = array(
					'title'=>$content['title'],
				);
		$content['lpanel'] = $this->load->view('dashboard/admin/content/lpanel','',true);
		$content['main'] = $this->load->view('dashboard/admin/content/album/main',$query,true);
		$content['lpanel_main'] = $this->load->view('dashboard/admin/content/album/act/home','',true);
//		$content['rpanel_main'] = $this->load->view('dashboard/admin/content/help/act','',true);
		$content['bottom'] = $this->load->view('dashboard/admin/content/album/bottom',$query,true);
		$content = $this->load->view("dashboard/admin/finalizeView/content",$content,true);
		
		/*
		 * load footer
		 */
		$footer = $this->config->item("footer");
		$footer = $this->load->view("dashboard/admin/finalizeView/footer",$footer,true);
		
		/*
		 * finalize view
		 */
		$jscript = array('LightFace','LightFace.Request');
		$css = array('pages','table','LightFace');
		$page = $this->config->item("page");
		$page['title'] = $page['title']." - ".$this->title;
		$this->finalizeViewAdmin(array(
			'title'=>$page['title'],
			'jscript_add'=>js_script($jscript),
			'css_add'=>css_script($css),
    		'jscript'=>js_script($page['jscript_default']),
    		'css'=>css_script($page['css_default']),
			'header'=>$header,
    		'content'=>$content,
			'footer'=>$footer,
			'layout_width'=>950,
			
		));
	}
	
	function member(){
		$this->title = "Member";
		/*
		 * load header
		 */
		$header = $this->config->item("header");
		$header = $this->load->view("dashboard/admin/finalizeView/header",$header,true);
		
		/*
		 * load content
		 */
		$content = $this->config->item("content");
		$content['title'] = $this->title;
		$content['w_lpanel'] = "10%";
		$content['w_main'] = "80%";
		$content['w_lpanel_main'] = "100%";
		$content['w_rpanel_main'] = "0%";
		$query = array(
					'title'=>$content['title'],
				);
		$content['lpanel'] = $this->load->view('dashboard/admin/content/lpanel','',true);
		$content['main'] = $this->load->view('dashboard/admin/content/member/main',$query,true);
		$content['lpanel_main'] = $this->load->view('dashboard/admin/content/member/act/home','',true);
//		$content['rpanel_main'] = $this->load->view('dashboard/admin/content/news/act','',true);
		$content['bottom'] = $this->load->view('dashboard/admin/content/member/bottom',$query,true);
		$content = $this->load->view("dashboard/admin/finalizeView/content",$content,true);
		
		/*
		 * load footer
		 */
		$footer = $this->config->item("footer");
		$footer = $this->load->view("dashboard/admin/finalizeView/footer",$footer,true);
		
		/*
		 * finalize view
		 */
		$jscript = array('LightFace','LightFace.Request');
		$css = array('pages','table','LightFace');
		$page = $this->config->item("page");
		$page['title'] = $page['title']." - ".$this->title;
		$this->finalizeViewAdmin(array(
			'title'=>$page['title'],
			'jscript_add'=>js_script($jscript),
			'css_add'=>css_script($css),
    		'jscript'=>js_script($page['jscript_default']),
    		'css'=>css_script($page['css_default']),
			'header'=>$header,
    		'content'=>$content,
			'footer'=>$footer,
			'layout_width'=>950,
			
		));
	}
	
	function news_show(){
		$this->load->model("newsMod");
		
		$limit = $this->uri->segment(3,0);
		$offset = $this->uri->segment(4,0);
		$search = $this->uri->segment(5,0);
		
		if($search==""){
    		$query = $this->newsMod->get_record($limit,$offset);
		} else {
			$search =  str_replace("%20"," ",$search);
			$query = $this->newsMod->get_where($search,$limit,$offset);
		}
    	    	
		$this->load->view('dashboard/admin/content/news/act/show',array('query'=>$query));
	}
	
	function event_show(){
		$this->load->model("eventMod");
		
		$limit = $this->uri->segment(3,0);
		$offset = $this->uri->segment(4,0);
		$search = $this->uri->segment(5,0);
		
		if($search==""){
    		$query = $this->eventMod->get_record($limit,$offset);
		} else {
			$search =  str_replace("%20"," ",$search);
			$query = $this->eventMod->get_where($search,$limit,$offset);
		}
    	    	
		$this->load->view('dashboard/admin/content/event/act/show',array('query'=>$query));
	}

	function help_show(){
		$this->load->model("helpMod");
		
		$limit = $this->uri->segment(3,0);
		$offset = $this->uri->segment(4,0);
		$search = $this->uri->segment(5,0);
		
		if($search==""){
    		$query = $this->helpMod->get_record($limit,$offset);
		} else {
			$search =  str_replace("%20"," ",$search);
			$query = $this->helpMod->get_where($search,$limit,$offset);
		}
    	    	
		$this->load->view('dashboard/admin/content/help/act/show',array('query'=>$query));
	}
	
	function edisi_show(){
		$this->load->model("edisiMod");
		
		$limit = $this->uri->segment(3,0);
		$offset = $this->uri->segment(4,0);
		$search = $this->uri->segment(5,0);
		
		if($search==""){
    		$query = $this->edisiMod->get_record($limit,$offset);
		} else {
			$search =  str_replace("%20"," ",$search);
			$query = $this->edisiMod->get_record_where($search,$limit,$offset);
		}
    	    	
		$this->load->view('dashboard/admin/content/edisi/act/show',array('query'=>$query));
	}
	
	function content_edisi_show(){
		$this->load->model("edisiContentMod");
		
		$limit = $this->uri->segment(3,0);
		$offset = $this->uri->segment(4,0);
		$where1 = $this->uri->segment(5,0);
		$where2 = $this->uri->segment(6,0);
		$search = $this->uri->segment(7,0);
		
			$q = $this->db->query("select id_edisi from edisi where ke='$where1' limit 1");
			foreach ($q->result() as $re):
					$where1 = $re->id_edisi;
			endforeach;
		
		$where = array(
					'edisi'=>$where1,
					'category'=>$where2
				 );
		
		if($search==""){
    		$query = $this->edisiContentMod->get_where($where,$limit,$offset);
//    		$query = $this->edisiContentMod->get_record($limit,$offset);
		} else {
			$search =  str_replace("%20"," ",$search);
			$query = $this->edisiContentMod->get_record_where($search,$limit,$offset);
		}
    	    	
		$this->load->view('dashboard/admin/content/edisi/act/show_content',array('query'=>$query));
	}
	
	function album_show(){
		$this->load->model("albumMod");
		
		$limit = $this->uri->segment(3,0);
		$offset = $this->uri->segment(4,0);
		$search = $this->uri->segment(5,0);
		
		if($search==""){
    		$query = $this->albumMod->get_record($limit,$offset);
		} else {
			$search =  str_replace("%20"," ",$search);
			$query = $this->albumMod->get_where($search,$limit,$offset);
		}
    	    	
		$this->load->view('dashboard/admin/content/album/act/show',array('query'=>$query));
	}
	
	function content_images_show(){
		$this->load->model("imagesMod");
		$this->load->model("albumMod");
		
		$limit = $this->uri->segment(3,0);
		$offset = $this->uri->segment(4,0);
		$where1 = $this->uri->segment(5,0);
		$where2 = $this->uri->segment(6,0);
		$search = $this->uri->segment(7,0);
		
//			$q = $this->db->query("select id_edisi from edisi where ke='$where1' limit 1");
//			foreach ($q->result() as $re):
//					$where1 = $re->id_edisi;
//			endforeach;
		
		$where = array(
					'album'=>$where1,
//					'category'=>$where2
				 );
		
		if($search==""){
    		$query = $this->imagesMod->get_where($where1,$limit,$offset);
//    		$query = $this->edisiContentMod->get_record($limit,$offset);
		} else {
			$search =  str_replace("%20"," ",$search);
			$query = $this->imagesMod->get_record_where($search,$limit,$offset);
		}
    	    	
		$this->load->view('dashboard/admin/content/album/act/show_content',array('query'=>$query));
	}
	
	function member_show(){
		$this->load->model("memberMod");
		
		$limit = $this->uri->segment(3,0);
		$offset = $this->uri->segment(4,0);
		$search = $this->uri->segment(5,0);
		
		if($search==""){
    		$query = $this->memberMod->get_record($limit,$offset);
		} else {
			$search =  str_replace("%20"," ",$search);
			$query = $this->memberMod->get_where($search,$limit,$offset);
		}
    	    	
		$this->load->view('dashboard/admin/content/member/act/show',array('query'=>$query));
	}
	
	function news_add(){
		$this->title = "News Add";
		$code = $this->uri->segment(3,0);
		/*
		 * load header
		 */
		$header = $this->config->item("header");
		$header = $this->load->view("dashboard/admin/finalizeView/header",$header,true);
		
		/*
		 * load content
		 */
		$content = $this->config->item("content");
		$content['title'] = $this->title;
		$content['w_lpanel'] = "10%";
		$content['w_main'] = "80%";
		$content['w_lpanel_main'] = "100%";
		$content['w_rpanel_main'] = "0%";
		$query = array(
					'title'=>$content['title'],
				);
		$content['lpanel'] = $this->load->view('dashboard/admin/content/lpanel','',true);
		$content['main'] = $this->load->view('dashboard/admin/content/news/act/main',$query,true);
		$content['lpanel_main'] = $this->load->view('dashboard/admin/content/news/act/add','',true);
//		$content['rpanel_main'] = $this->load->view('dashboard/admin/content/edisi/act','',true);
		$content['bottom'] = $this->load->view('dashboard/admin/content/news/act/bottom',$query,true);
		$content = $this->load->view("dashboard/admin/finalizeView/content",$content,true);
		
		/*
		 * load footer
		 */
		$footer = $this->config->item("footer");
		$footer = $this->load->view("dashboard/admin/finalizeView/footer",$footer,true);
		
		/*
		 * finalize view
		 */
		$jscript = array('mooEditable/MooEditable','mooEditable/MooEditable.UI.MenuList','mooEditable/MooEditable.Extras','formcheck');
		$css = array('pages','table','mooEditable/MooEditable','mooEditable/MooEditable.Extras','formcheck');
		$page = $this->config->item("page");
		$page['title'] = $page['title']." - ".$this->title;
		$this->finalizeViewAdmin(array(
			'title'=>$page['title'],
			'jscript_add'=>js_script($jscript),
			'css_add'=>css_script($css),
    		'jscript'=>js_script($page['jscript_default']),
    		'css'=>css_script($page['css_default']),
			'header'=>$header,
    		'content'=>$content,
			'footer'=>$footer,
			'layout_width'=>950,
			
		));
	}
	
	function event_add(){
		$this->title = "Event Add";
		$code = $this->uri->segment(3,0);
		/*
		 * load header
		 */
		$header = $this->config->item("header");
		$header = $this->load->view("dashboard/admin/finalizeView/header",$header,true);
		
		/*
		 * load content
		 */
		$content = $this->config->item("content");
		$content['title'] = $this->title;
		$content['w_lpanel'] = "10%";
		$content['w_main'] = "80%";
		$content['w_lpanel_main'] = "100%";
		$content['w_rpanel_main'] = "0%";
		$query = array(
					'title'=>$content['title'],
				);
		$content['lpanel'] = $this->load->view('dashboard/admin/content/lpanel','',true);
		$content['main'] = $this->load->view('dashboard/admin/content/event/act/main',$query,true);
		$content['lpanel_main'] = $this->load->view('dashboard/admin/content/event/act/add','',true);
//		$content['rpanel_main'] = $this->load->view('dashboard/admin/content/edisi/act','',true);
		$content['bottom'] = $this->load->view('dashboard/admin/content/event/act/bottom',$query,true);
		$content = $this->load->view("dashboard/admin/finalizeView/content",$content,true);
		
		/*
		 * load footer
		 */
		$footer = $this->config->item("footer");
		$footer = $this->load->view("dashboard/admin/finalizeView/footer",$footer,true);
		
		/*
		 * finalize view
		 */
		$jscript = array('mooEditable/MooEditable','mooEditable/MooEditable.UI.MenuList','mooEditable/MooEditable.Extras','formcheck');
		$css = array('pages','table','mooEditable/MooEditable','mooEditable/MooEditable.Extras','formcheck');
		$page = $this->config->item("page");
		$page['title'] = $page['title']." - ".$this->title;
		$this->finalizeViewAdmin(array(
			'title'=>$page['title'],
			'jscript_add'=>js_script($jscript),
			'css_add'=>css_script($css),
    		'jscript'=>js_script($page['jscript_default']),
    		'css'=>css_script($page['css_default']),
			'header'=>$header,
    		'content'=>$content,
			'footer'=>$footer,
			'layout_width'=>950,
			
		));
	}
	
	function help_add(){
		$this->title = "Help Add";
		$code = $this->uri->segment(3,0);
		/*
		 * load header
		 */
		$header = $this->config->item("header");
		$header = $this->load->view("dashboard/admin/finalizeView/header",$header,true);
		
		/*
		 * load content
		 */
		$content = $this->config->item("content");
		$content['title'] = $this->title;
		$content['w_lpanel'] = "10%";
		$content['w_main'] = "80%";
		$content['w_lpanel_main'] = "100%";
		$content['w_rpanel_main'] = "0%";
		$query = array(
					'title'=>$content['title'],
				);
		$content['lpanel'] = $this->load->view('dashboard/admin/content/lpanel','',true);
		$content['main'] = $this->load->view('dashboard/admin/content/help/act/main',$query,true);
		$content['lpanel_main'] = $this->load->view('dashboard/admin/content/help/act/add','',true);
//		$content['rpanel_main'] = $this->load->view('dashboard/admin/content/help/act','',true);
		$content['bottom'] = $this->load->view('dashboard/admin/content/help/act/bottom',$query,true);
		$content = $this->load->view("dashboard/admin/finalizeView/content",$content,true);
		
		/*
		 * load footer
		 */
		$footer = $this->config->item("footer");
		$footer = $this->load->view("dashboard/admin/finalizeView/footer",$footer,true);
		
		/*
		 * finalize view
		 */
		$jscript = array('mooEditable/MooEditable','mooEditable/MooEditable.UI.MenuList','mooEditable/MooEditable.Extras','formcheck');
		$css = array('pages','table','mooEditable/MooEditable','mooEditable/MooEditable.Extras','formcheck');
		$page = $this->config->item("page");
		$page['title'] = $page['title']." - ".$this->title;
		$this->finalizeViewAdmin(array(
			'title'=>$page['title'],
			'jscript_add'=>js_script($jscript),
			'css_add'=>css_script($css),
    		'jscript'=>js_script($page['jscript_default']),
    		'css'=>css_script($page['css_default']),
			'header'=>$header,
    		'content'=>$content,
			'footer'=>$footer,
			'layout_width'=>950,
			
		));
	}
	
	function edisi_add(){
		$this->title = "Edisi Add";
		$code = $this->uri->segment(3,0);
		/*
		 * load header
		 */
		$header = $this->config->item("header");
		$header = $this->load->view("dashboard/admin/finalizeView/header",$header,true);
		
		/*
		 * load content
		 */
		$content = $this->config->item("content");
		$content['title'] = $this->title;
		$content['w_lpanel'] = "10%";
		$content['w_main'] = "80%";
		$content['w_lpanel_main'] = "100%";
		$content['w_rpanel_main'] = "0%";
		$query = array(
					'title'=>$content['title'],
				);
		$content['lpanel'] = $this->load->view('dashboard/admin/content/lpanel','',true);
		$content['main'] = $this->load->view('dashboard/admin/content/edisi/act/main',$query,true);
		$content['lpanel_main'] = $this->load->view('dashboard/admin/content/edisi/act/add_edisi','',true);
//		$content['rpanel_main'] = $this->load->view('dashboard/admin/content/edisi/act','',true);
		$content['bottom'] = $this->load->view('dashboard/admin/content/edisi/act/bottom',$query,true);
		$content = $this->load->view("dashboard/admin/finalizeView/content",$content,true);
		
		/*
		 * load footer
		 */
		$footer = $this->config->item("footer");
		$footer = $this->load->view("dashboard/admin/finalizeView/footer",$footer,true);
		
		/*
		 * finalize view
		 */
		$jscript = array('formcheck');
		$css = array('pages','table','formcheck');
		$page = $this->config->item("page");
		$page['title'] = $page['title']." - ".$this->title;
		$this->finalizeViewAdmin(array(
			'title'=>$page['title'],
			'jscript_add'=>js_script($jscript),
			'css_add'=>css_script($css),
    		'jscript'=>js_script($page['jscript_default']),
    		'css'=>css_script($page['css_default']),
			'header'=>$header,
    		'content'=>$content,
			'footer'=>$footer,
			'layout_width'=>950,
			
		));
	}
	
	function content_edisi_add(){
		$this->load->model('edisiMod');
		$this->title = "Content Edisi Add";
		$code = $this->uri->segment(3,0);
		/*
		 * load header
		 */
		$header = $this->config->item("header");
		$header = $this->load->view("dashboard/admin/finalizeView/header",$header,true);
		
		/*
		 * load content
		 */
		$content = $this->config->item("content");
		$content['title'] = $this->title;
		$content['w_lpanel'] = "10%";
		$content['w_main'] = "80%";
		$content['w_lpanel_main'] = "100%";
		$content['w_rpanel_main'] = "0%";
		
		$where = array('ke'=>$code);
		$query = array(
					'title'=>$content['title'],
					'query'=>$this->edisiMod->get_where($where)
				);
		$content['lpanel'] = $this->load->view('dashboard/admin/content/lpanel','',true);
		$content['main'] = $this->load->view('dashboard/admin/content/edisi/act/main_content',$query,true);
		$content['lpanel_main'] = $this->load->view('dashboard/admin/content/edisi/act/add_edisi_content','',true);
//		$content['rpanel_main'] = $this->load->view('dashboard/admin/content/edisi/act','',true);
		$content['bottom'] = $this->load->view('dashboard/admin/content/edisi/act/bottom_content',$query,true);
		$content = $this->load->view("dashboard/admin/finalizeView/content",$content,true);
		
		/*
		 * load footer
		 */
		$footer = $this->config->item("footer");
		$footer = $this->load->view("dashboard/admin/finalizeView/footer",$footer,true);
		
		/*
		 * finalize view
		 */
		$jscript = array('formcheck','mooEditable/MooEditable','mooEditable/MooEditable.UI.MenuList','mooEditable/MooEditable.Extras');
		$css = array('pages','table','formcheck','mooEditable/MooEditable','mooEditable/MooEditable.Extras');
		$page = $this->config->item("page");
		$page['title'] = $page['title']." - ".$this->title;
		$this->finalizeViewAdmin(array(
			'title'=>$page['title'],
			'jscript_add'=>js_script($jscript),
			'css_add'=>css_script($css),
    		'jscript'=>js_script($page['jscript_default']),
    		'css'=>css_script($page['css_default']),
			'header'=>$header,
    		'content'=>$content,
			'footer'=>$footer,
			'layout_width'=>950,
			
		));
	}
	
	function album_add(){
		$this->title = "Add Album";
		$code = $this->uri->segment(3,0);
		/*
		 * load header
		 */
		$header = $this->config->item("header");
		$header = $this->load->view("dashboard/admin/finalizeView/header",$header,true);
		
		/*
		 * load content
		 */
		$content = $this->config->item("content");
		$content['title'] = $this->title;
		$content['w_lpanel'] = "10%";
		$content['w_main'] = "80%";
		$content['w_lpanel_main'] = "100%";
		$content['w_rpanel_main'] = "0%";
		$query = array(
					'title'=>$content['title'],
				);
		$content['lpanel'] = $this->load->view('dashboard/admin/content/lpanel','',true);
		$content['main'] = $this->load->view('dashboard/admin/content/album/act/main_content',$query,true);
		$content['lpanel_main'] = $this->load->view('dashboard/admin/content/album/act/add_album','',true);
//		$content['rpanel_main'] = $this->load->view('dashboard/admin/content/album/act','',true);
		$content['bottom'] = $this->load->view('dashboard/admin/content/album/act/bottom_content',$query,true);
		$content = $this->load->view("dashboard/admin/finalizeView/content",$content,true);
		
		/*
		 * load footer
		 */
		$footer = $this->config->item("footer");
		$footer = $this->load->view("dashboard/admin/finalizeView/footer",$footer,true);
		
		/*
		 * finalize view
		 */
		$jscript = array('formcheck','mooEditable/MooEditable','mooEditable/MooEditable.UI.MenuList',
						'mooEditable/MooEditable.Extras','tbl/TextboxList','tbl/GrowingInput','tbl/TextboxList.Autocomplete');
		$css = array('pages','table','formcheck','mooEditable/MooEditable','mooEditable/MooEditable.Extras','tbl/TextboxList',
					'tbl/TextboxList.Autocomplete');
		$page = $this->config->item("page");
		$page['title'] = $page['title']." - ".$this->title;
		$this->finalizeViewAdmin(array(
			'title'=>$page['title'],
			'jscript_add'=>js_script($jscript),
			'css_add'=>css_script($css),
    		'jscript'=>js_script($page['jscript_default']),
    		'css'=>css_script($page['css_default']),
			'header'=>$header,
    		'content'=>$content,
			'footer'=>$footer,
			'layout_width'=>950,
			
		));
	}
	
	function images_add(){
		$this->title = "Add Images";
		$code = $this->uri->segment(3,0);
		/*
		 * load header
		 */
		$header = $this->config->item("header");
		$header = $this->load->view("dashboard/admin/finalizeView/header",$header,true);
		
		/*
		 * load content
		 */
		$content = $this->config->item("content");
		$content['title'] = $this->title;
		$content['w_lpanel'] = "10%";
		$content['w_main'] = "80%";
		$content['w_lpanel_main'] = "100%";
		$content['w_rpanel_main'] = "0%";
		$query = array(
					'title'=>$content['title'],
				);
		$content['lpanel'] = $this->load->view('dashboard/admin/content/lpanel','',true);
		$content['main'] = $this->load->view('dashboard/admin/content/album/act/main_content',$query,true);
		$content['lpanel_main'] = $this->load->view('dashboard/admin/content/album/act/add_images','',true);
//		$content['rpanel_main'] = $this->load->view('dashboard/admin/content/album/act','',true);
		$content['bottom'] = $this->load->view('dashboard/admin/content/album/act/bottom_content',$query,true);
		$content = $this->load->view("dashboard/admin/finalizeView/content",$content,true);
		
		/*
		 * load footer
		 */
		$footer = $this->config->item("footer");
		$footer = $this->load->view("dashboard/admin/finalizeView/footer",$footer,true);
		
		/*
		 * finalize view
		 */
		$jscript = array('mooEditable/MooEditable','mooEditable/MooEditable.UI.MenuList','mooEditable/MooEditable.Extras','formcheck',
						'tbl/TextboxList','tbl/GrowingInput','tbl/TextboxList.Autocomplete');
		$css = array('pages','table','mooEditable/MooEditable','mooEditable/MooEditable.Extras','formcheck','tbl/TextboxList',
					'tbl/TextboxList.Autocomplete');
		$page = $this->config->item("page");
		$page['title'] = $page['title']." - ".$this->title;
		$this->finalizeViewAdmin(array(
			'title'=>$page['title'],
			'jscript_add'=>js_script($jscript),
			'css_add'=>css_script($css),
    		'jscript'=>js_script($page['jscript_default']),
    		'css'=>css_script($page['css_default']),
			'header'=>$header,
    		'content'=>$content,
			'footer'=>$footer,
			'layout_width'=>950,
			
		));
	}
	
	function member_add(){
		$this->title = "Member Add";
		$code = $this->uri->segment(3,0);
		/*
		 * load header
		 */
		$header = $this->config->item("header");
		$header = $this->load->view("dashboard/admin/finalizeView/header",$header,true);
		
		/*
		 * load content
		 */
		$content = $this->config->item("content");
		$content['title'] = $this->title;
		$content['w_lpanel'] = "10%";
		$content['w_main'] = "80%";
		$content['w_lpanel_main'] = "100%";
		$content['w_rpanel_main'] = "0%";
		$query = array(
					'title'=>$content['title'],
				 );
		$content['lpanel'] = $this->load->view('dashboard/admin/content/lpanel','',true);
		$content['main'] = $this->load->view('dashboard/admin/content/member/act/main',$query,true);
		$content['lpanel_main'] = $this->load->view('dashboard/admin/content/member/act/add','',true);
//		$content['rpanel_main'] = $this->load->view('dashboard/admin/content/member/act','',true);
		$content['bottom'] = $this->load->view('dashboard/admin/content/member/act/bottom',$query,true);
		$content = $this->load->view("dashboard/admin/finalizeView/content",$content,true);
		
		/*
		 * load footer
		 */
		$footer = $this->config->item("footer");
		$footer = $this->load->view("dashboard/admin/finalizeView/footer",$footer,true);
		
		/*
		 * finalize view
		 */
		$jscript = array('formcheck','datepicker');
		$css = array('pages','table','formcheck','datepicker');
		$page = $this->config->item("page");
		$page['title'] = $page['title']." - ".$this->title;
		$this->finalizeViewAdmin(array(
			'title'=>$page['title'],
			'jscript_add'=>js_script($jscript),
			'css_add'=>css_script($css),
    		'jscript'=>js_script($page['jscript_default']),
    		'css'=>css_script($page['css_default']),
			'header'=>$header,
    		'content'=>$content,
			'footer'=>$footer,
			'layout_width'=>950,
			
		));
	}
	
	function news_edit(){
		$this->load->model("newsMod");
		$this->title = "News Edit";
		$code = $this->uri->segment(3,0);
		/*
		 * load header
		 */
		$header = $this->config->item("header");
		$header = $this->load->view("dashboard/admin/finalizeView/header",$header,true);
		
		/*
		 * load content
		 */
		$content = $this->config->item("content");
		$content['title'] = $this->title;
		$content['w_lpanel'] = "10%";
		$content['w_main'] = "80%";
		$content['w_lpanel_main'] = "100%";
		$content['w_rpanel_main'] = "0%";
		
		$que = $this->newsMod->get($code);
		$query = array(
					'title'=>$content['title'],
					'query'=>$que
				);
		$content['lpanel'] = $this->load->view('dashboard/admin/content/lpanel','',true);
		$content['main'] = $this->load->view('dashboard/admin/content/news/act/main',$query,true);
		$content['lpanel_main'] = $this->load->view('dashboard/admin/content/news/act/edit',$query,true);
//		$content['rpanel_main'] = $this->load->view('dashboard/admin/content/edisi/act','',true);
		$content['bottom'] = $this->load->view('dashboard/admin/content/news/act/bottom',$query,true);
		$content = $this->load->view("dashboard/admin/finalizeView/content",$content,true);
		
		/*
		 * load footer
		 */
		$footer = $this->config->item("footer");
		$footer = $this->load->view("dashboard/admin/finalizeView/footer",$footer,true);
		
		/*
		 * finalize view
		 */
		$jscript = array('mooEditable/MooEditable','mooEditable/MooEditable.UI.MenuList','mooEditable/MooEditable.Extras','formcheck');
		$css = array('pages','table','mooEditable/MooEditable','mooEditable/MooEditable.Extras','formcheck');
		$page = $this->config->item("page");
		$page['title'] = $page['title']." - ".$this->title;
		$this->finalizeViewAdmin(array(
			'title'=>$page['title'],
			'jscript_add'=>js_script($jscript),
			'css_add'=>css_script($css),
    		'jscript'=>js_script($page['jscript_default']),
    		'css'=>css_script($page['css_default']),
			'header'=>$header,
    		'content'=>$content,
			'footer'=>$footer,
			'layout_width'=>950,
			
		));
	}
	
	function event_edit(){
		$this->load->model("eventMod");
		$this->title = "Event Edit";
		$code = $this->uri->segment(3,0);
		/*
		 * load header
		 */
		$header = $this->config->item("header");
		$header = $this->load->view("dashboard/admin/finalizeView/header",$header,true);
		
		/*
		 * load content
		 */
		$content = $this->config->item("content");
		$content['title'] = $this->title;
		$content['w_lpanel'] = "10%";
		$content['w_main'] = "80%";
		$content['w_lpanel_main'] = "100%";
		$content['w_rpanel_main'] = "0%";
		
		$que = $this->eventMod->get($code);
		$query = array(
					'title'=>$content['title'],
					'query'=>$que
				);
		$content['lpanel'] = $this->load->view('dashboard/admin/content/lpanel','',true);
		$content['main'] = $this->load->view('dashboard/admin/content/event/act/main',$query,true);
		$content['lpanel_main'] = $this->load->view('dashboard/admin/content/event/act/edit',$query,true);
//		$content['rpanel_main'] = $this->load->view('dashboard/admin/content/edisi/act','',true);
		$content['bottom'] = $this->load->view('dashboard/admin/content/event/act/bottom',$query,true);
		$content = $this->load->view("dashboard/admin/finalizeView/content",$content,true);
		
		/*
		 * load footer
		 */
		$footer = $this->config->item("footer");
		$footer = $this->load->view("dashboard/admin/finalizeView/footer",$footer,true);
		
		/*
		 * finalize view
		 */
		$jscript = array('mooEditable/MooEditable','mooEditable/MooEditable.UI.MenuList','mooEditable/MooEditable.Extras','formcheck');
		$css = array('pages','table','mooEditable/MooEditable','mooEditable/MooEditable.Extras','formcheck');
		$page = $this->config->item("page");
		$page['title'] = $page['title']." - ".$this->title;
		$this->finalizeViewAdmin(array(
			'title'=>$page['title'],
			'jscript_add'=>js_script($jscript),
			'css_add'=>css_script($css),
    		'jscript'=>js_script($page['jscript_default']),
    		'css'=>css_script($page['css_default']),
			'header'=>$header,
    		'content'=>$content,
			'footer'=>$footer,
			'layout_width'=>950,
			
		));
	}
	
	function help_edit(){
		$this->load->model("helpMod");
		$this->title = "Help Edit";
		$code = $this->uri->segment(3,0);
		/*
		 * load header
		 */
		$header = $this->config->item("header");
		$header = $this->load->view("dashboard/admin/finalizeView/header",$header,true);
		
		/*
		 * load content
		 */
		$content = $this->config->item("content");
		$content['title'] = $this->title;
		$content['w_lpanel'] = "10%";
		$content['w_main'] = "80%";
		$content['w_lpanel_main'] = "100%";
		$content['w_rpanel_main'] = "0%";
		
		$que = $this->helpMod->get($code);
		$query = array(
					'title'=>$content['title'],
					'query'=>$que
				);
		$content['lpanel'] = $this->load->view('dashboard/admin/content/lpanel','',true);
		$content['main'] = $this->load->view('dashboard/admin/content/help/act/main',$query,true);
		$content['lpanel_main'] = $this->load->view('dashboard/admin/content/help/act/edit',$query,true);
//		$content['rpanel_main'] = $this->load->view('dashboard/admin/content/help/act','',true);
		$content['bottom'] = $this->load->view('dashboard/admin/content/help/act/bottom',$query,true);
		$content = $this->load->view("dashboard/admin/finalizeView/content",$content,true);
		
		/*
		 * load footer
		 */
		$footer = $this->config->item("footer");
		$footer = $this->load->view("dashboard/admin/finalizeView/footer",$footer,true);
		
		/*
		 * finalize view
		 */
		$jscript = array('mooEditable/MooEditable','mooEditable/MooEditable.UI.MenuList','mooEditable/MooEditable.Extras','formcheck');
		$css = array('pages','table','mooEditable/MooEditable','mooEditable/MooEditable.Extras','formcheck');
		$page = $this->config->item("page");
		$page['title'] = $page['title']." - ".$this->title;
		$this->finalizeViewAdmin(array(
			'title'=>$page['title'],
			'jscript_add'=>js_script($jscript),
			'css_add'=>css_script($css),
    		'jscript'=>js_script($page['jscript_default']),
    		'css'=>css_script($page['css_default']),
			'header'=>$header,
    		'content'=>$content,
			'footer'=>$footer,
			'layout_width'=>950,
			
		));
	}
	
	function member_edit(){
		$this->load->model("memberMod");
		$this->title = "Member Edit";
		$code = $this->uri->segment(3,0);
		/*
		 * load header
		 */
		$header = $this->config->item("header");
		$header = $this->load->view("dashboard/admin/finalizeView/header",$header,true);
		
		/*
		 * load content
		 */
		$content = $this->config->item("content");
		$content['title'] = $this->title;
		$content['w_lpanel'] = "10%";
		$content['w_main'] = "80%";
		$content['w_lpanel_main'] = "100%";
		$content['w_rpanel_main'] = "0%";
		
		$que = $this->memberMod->get($code);
		$query = array(
					'title'=>$content['title'],
					'query'=>$que
				);
		$content['lpanel'] = $this->load->view('dashboard/admin/content/lpanel','',true);
		$content['main'] = $this->load->view('dashboard/admin/content/member/act/main',$query,true);
		$content['lpanel_main'] = $this->load->view('dashboard/admin/content/member/act/edit',$query,true);
//		$content['rpanel_main'] = $this->load->view('dashboard/admin/content/member/act','',true);
		$content['bottom'] = $this->load->view('dashboard/admin/content/member/act/bottom',$query,true);
		$content = $this->load->view("dashboard/admin/finalizeView/content",$content,true);
		
		/*
		 * load footer
		 */
		$footer = $this->config->item("footer");
		$footer = $this->load->view("dashboard/admin/finalizeView/footer",$footer,true);
		
		/*
		 * finalize view
		 */
		$jscript = array('formcheck','datepicker');
		$css = array('pages','table','formcheck','datepicker');
		$page = $this->config->item("page");
		$page['title'] = $page['title']." - ".$this->title;
		$this->finalizeViewAdmin(array(
			'title'=>$page['title'],
			'jscript_add'=>js_script($jscript),
			'css_add'=>css_script($css),
    		'jscript'=>js_script($page['jscript_default']),
    		'css'=>css_script($page['css_default']),
			'header'=>$header,
    		'content'=>$content,
			'footer'=>$footer,
			'layout_width'=>950,
			
		));
	}
	
	function news_save(){
		$this->load->model("newsMod");
		
		$author = $this->member;
		$name = $this->input->post("name");
		$description = $this->input->post("description");
		$description = str_replace(array('<p>','</p>','<p class="para">'),"",$description);
		$id = $this->newsMod->generateID($name);
		$images_tmp = $_FILES['images']['tmp_name'];
		$images_type = $_FILES['images']['type'];
		$large_width = 600;
		$medium_width = 300;
		$small_width = 75;
		
		if($images_type=="" || $images_type==NULL){
			$data = array(
						'id_news'=>$id,
						'author'=>$author,
						'name'=>$name,
						'description'=>$description
					);
		} else {
			$data = array(
						'id_news'=>$id,
						'author'=>$author,
						'name'=>$name,
						'images_large'=>$this->images_large($images_tmp,$large_width,$name,$images_type),
						'images_medium'=>$this->images_medium($images_tmp,$medium_width,$name,$images_type),
						'images_small'=>$this->images_small($images_tmp,$small_width,$name,$images_type),
						'images_type'=>$images_type,
						'description'=>$description
					);
		}
		$this->newsMod->add($data);
		redirect('just4u/news/');
	}
	
	function event_save(){
		$this->load->model("eventMod");
		
		$author = $this->member;
		$name = $this->input->post("name");
		$description = $this->input->post("description");
		$description = str_replace(array('<p>','</p>','<p class="para">'),"",$description);
		$id = $this->eventMod->generateID($name);
		$images_tmp = $_FILES['images']['tmp_name'];
		$images_type = $_FILES['images']['type'];
		$medium_width = 150;
		$small_width = 75;
		
		if($images_type=="" || $images_type==NULL){
			$data = array(
						'id_event'=>$id,
						'author'=>$author,
						'name'=>$name,
						'description'=>$description
					);
		} else {
			$data = array(
						'id_event'=>$id,
						'author'=>$author,
						'name'=>$name,
						'images_large'=>$this->images_large($images_tmp,$name,$images_type),
						'images_medium'=>$this->images_medium($images_tmp,$medium_width,$name,$images_type),
						'images_small'=>$this->images_small($images_tmp,$small_width,$name,$images_type),
						'images_type'=>$images_type,
						'description'=>$description
					);
		}
		$this->eventMod->add($data);
		redirect('just4u/event/');
	}
	
	function help_save(){
		$this->load->model("helpMod");
		
		$author = $this->member;
		$title = $this->input->post("title");
		$question = $this->input->post("question");
		$question = str_replace(array('<p>','</p>','<p class="para">'),"",$question);
		$from = $this->input->post("from");
		$email = $this->input->post("email");
		$answer = $this->input->post("answer");
		$answer = str_replace(array('<p>','</p>','<p class="para">'),"",$answer);
		$id = $this->helpMod->generateID($title);
		
		$data = array(
					'id_help'=>$id,
					'author'=>$author,
					'title'=>$title,
					'question'=>$question,
					'from'=>$from,
					'email'=>$email,
					'answer'=>$answer,
				);
		
		$this->helpMod->add($data);
		redirect('just4u/help/');
	}
	
	function edisi_save(){
		$this->load->model("edisiMod");
		
		$author = $this->member;
		$ke = $this->input->post("ke");
		$id = $this->edisiMod->generateID($ke);
		$images_tmp = $_FILES['images']['tmp_name'];
		$images_type = $_FILES['images']['type'];
		$large_width = 600;
		$medium_width = 300;
		$small_width = 75;
		
		if($images_type=="" || $images_type==NULL){
			$data = array(
						'id_edisi'=>$id,
						'author'=>$author,
						'ke'=>$ke
					);
		} else {
			$data = array(
						'id_edisi'=>$id,
						'author'=>$author,
						'ke'=>$ke,
						'images_large'=>$this->images_large($images_tmp,$large_width,$ke,$images_type),
						'images_medium'=>$this->images_medium($images_tmp,$medium_width,$ke,$images_type),
						'images_small'=>$this->images_small($images_tmp,$small_width,$ke,$images_type),
						'images_type'=>$images_type
					);
		}
		$this->edisiMod->add($data);
		redirect('just4u/edisi/');
	}
	
	function edisi_content_save(){
		$this->load->model("edisiContentMod");
		$code = $this->uri->segment(3,0);
		$menu = $this->uri->segment(4,0);
		
		$author = $this->member;
		$edisi = $this->input->post("edisi");
		$category = $this->input->post("category");
		$name = $this->input->post("name");
		$description = $this->input->post("description");
		$description = str_replace(array('<p>','</p>','<p class="para">'),"",$description);
		$id = $this->edisiContentMod->generateID($name);
		
		$data = array(
					'id_content_edisi'=>$id,
					'author'=>$author,
					'edisi'=>$edisi,
					'category'=>$category,
					'name'=>$name,
					'description'=>$description,
				);
	
		$this->edisiContentMod->add($data);
		redirect("just4u/content_edisi/$code/$menu");
	}
	
	function album_save(){
		$this->load->model("albumMod");
		
		$author = $this->member;
		$cover = "";
		$name = $this->input->post("name");
		$tag = $this->input->post("tag");
		$description = $this->input->post("description");
		$description = str_replace(array('<p>','</p>','<p class="para">'),"",$description);
		$id = $this->albumMod->generateID($name);
		
		$data = array(
					'id_album'=>$id,
					'author'=>$author,
					'cover'=>$cover,
					'name'=>$name,
					'tag'=>$tag,
					'description'=>$description,
				);
		
		$this->albumMod->add($data);
		redirect('just4u/album/');
	}
	
	function images_save(){
		$this->load->model("imagesMod");
		$uri = $this->uri->segment(3,0);
		
		$author = $this->member;
		$album = $this->input->post("album");
		$name = $this->input->post("name");
		$tag = $this->input->post("tag");
		$description = $this->input->post("description");
		$id = $this->imagesMod->generateID($name);
		$images_tmp = $_FILES['images']['tmp_name'];
		$images_type = $_FILES['images']['type'];
		$large_width = 600;
		$medium_width = 300;
		$small_width = 75;
		
		if($images_type=="" || $images_type==NULL){
			$data = array(
						'id_images'=>$id,
						'author'=>$author,
						'album'=>$album,
						'name'=>$name,
						'tag'=>$tag,
						'description'=>$description
					);
		} else {
			$data = array(
						'id_images'=>$id,
						'author'=>$author,
						'album'=>$album,
						'name'=>$name,
						'images_large'=>$this->images_large($images_tmp,$large_width,$name,$images_type),
						'images_medium'=>$this->images_medium($images_tmp,$medium_width,$name,$images_type),
						'images_small'=>$this->images_small($images_tmp,$small_width,$name,$images_type),
						'images_type'=>$images_type,
						'tag'=>$tag,
						'description'=>$description
					);
		}
		$this->imagesMod->add($data);
		redirect("just4u/content_album/$uri");
	}
	
	function member_save(){
		$this->load->model("memberMod");
		$this->load->model("infoMemberMod");
		$this->load->model("contactMemberMod");
		
		/*
		 * member table
		 * $this->input->post("");
		 */
		$username = $this->input->post("username");
		$password = $this->input->post("password");
		$type = $this->input->post("type");
		$status = $this->input->post("status");
		$id = $this->memberMod->generateID($username);
		$images_tmp = $_FILES['images']['tmp_name'];
		$images_type = $_FILES['images']['type'];
		$large_width = 600;
		$medium_width = 300;
		$small_width = 75;
		
		if($images_type=="" || $images_type==NULL){
			$data = array(
						'id_member'=>$id,
						'username'=>$username,
						'password'=>$password,
						'type'=>$type,
						'status'=>$status
					);
		} else {
			$data = array(
						'id_member'=>$id,
						'username'=>$username,
						'password'=>$password,
						'images_large'=>$this->images_large($images_tmp,$large_width,$username,$images_type),
						'images_medium'=>$this->images_medium($images_tmp,$medium_width,$username,$images_type),
						'images_small'=>$this->images_small($images_tmp,$small_width,$username,$images_type),
						'images_type'=>$images_type,
						'type'=>$type,
						'status'=>$status
					);
		}
		/*
		 * info table
		 */
		$name = $this->input->post("name");
		$birthday = date("Y-m-d",$this->input->post("birthday"));
		$place_of_birth = $this->input->post("place_of_birth");
		$gender = $this->input->post("gender");
		$data_info = array(
						'member'=>$id,
						'name'=>$name,
						'birthday'=>$birthday,
						'place_of_birth'=>$place_of_birth,
						'gender'=>$gender
					);
		
		/*
		 * contact table
		 */
		$address = $this->input->post("address");
		$phone1 = $this->input->post("phone1");
		$phone2 = $this->input->post("phone2");
		$email1 = $this->input->post("email1");
		$email2 = $this->input->post("email2");
		$website = $this->input->post("website"); 
		$data_contact = array(
							'member'=>$id,
							'address'=>$address,
							'phone1'=>$phone1,
							'phone2'=>$phone2,
							'email1'=>$email1,
							'email2'=>$email2,
							'website'=>$website
						);
		
		
		$this->memberMod->add($data);
		$this->infoMemberMod->add($data_info);
		$this->contactMemberMod->add($data_contact);
		redirect('just4u/member/');
	}
	
	function news_delete(){
		$this->load->model("newsMod");
		$id = $this->uri->segment(3,0);
//		echo $id;
		$this->newsMod->remove($id);
		return true;
	}
	
	function event_delete(){
		$this->load->model("eventMod");
		$id = $this->uri->segment(3,0);
		$this->eventMod->remove($id);
		return true;
	}
	
	function help_delete(){
		$this->load->model("helpMod");
		$id = $this->uri->segment(3,0);
		$this->helpMod->remove($id);
		return true;
	}
	
	function images_delete(){
		$this->load->model("imagesMod");
		$id = $this->uri->segment(3,0);
		$this->imagesMod->remove($id);
		return true;
	}
	
	function member_delete(){
		$this->load->model("memberMod");
		$id = $this->uri->segment(3,0);
		$this->memberMod->remove($id);
		return true;
	}
	
	function news_update(){
		$this->load->model("newsMod");
		
		$author = $this->member;
		$name = $this->input->post("name");
		$description = $this->input->post("description");
		$description = str_replace(array('<p>','</p>','<p class="para">'),"",$description);
		$id = $this->input->post("id");
		$images_tmp = $_FILES['images']['tmp_name'];
		$images_type = $_FILES['images']['type'];
		$large_width = 600;
		$medium_width = 300;
		$small_width = 75;
		
		
		if($images_type=="" || $images_type==NULL){
			$data = array(
						'id_news'=>$id,
						'author'=>$author,
						'name'=>$name,
						'description'=>$description
					);
		} else {
			$data = array(
						'id_news'=>$id,
						'author'=>$author,
						'name'=>$name,
						'images_large'=>$this->images_large($images_tmp,$large_width,$name,$images_type),
						'images_medium'=>$this->images_medium($images_tmp,$medium_width,$name,$images_type),
						'images_small'=>$this->images_small($images_tmp,$small_width,$name,$images_type),
						'images_type'=>$images_type,
						'description'=>$description
					);
		}
		
		$this->newsMod->update($id,$data);
		
		redirect("just4u/news");
	}
	
	function event_update(){
		$this->load->model("eventMod");
		
		$author = $this->member;
		$name = $this->input->post("name");
		$description = $this->input->post("description");
		$description = str_replace(array('<p>','</p>','<p class="para">'),"",$description);
		$id = $this->input->post("id");
		$images_tmp = $_FILES['images']['tmp_name'];
		$images_type = $_FILES['images']['type'];
		$large_width = 600;
		$medium_width = 300;
		$small_width = 75;
		
		
		if($images_type=="" || $images_type==NULL){
			$data = array(
						'id_event'=>$id,
						'author'=>$author,
						'name'=>$name,
						'description'=>$description
					);
		} else {
			$data = array(
						'id_event'=>$id,
						'author'=>$author,
						'name'=>$name,
						'images_large'=>$this->images_large($images_tmp,$large_width,$name,$images_type),
						'images_medium'=>$this->images_medium($images_tmp,$medium_width,$name,$images_type),
						'images_small'=>$this->images_small($images_tmp,$small_width,$name,$images_type),
						'images_type'=>$images_type,
						'description'=>$description
					);
		}
		
		$this->eventMod->update($id,$data);
		
		redirect("just4u/event");
	}
	
	function help_update(){
		$this->load->model("helpMod");
		$code = $this->uri->segment(3,0);
		
		$author = $this->member;
		$title = $this->input->post("title");
		$question = $this->input->post("question");
		$question = str_replace(array('<p>','</p>','<p class="para">'),"",$question);
		$from = $this->input->post("from");
		$email = $this->input->post("email");
		$answer = $this->input->post("answer");
		$answer = str_replace(array('<p>','</p>','<p class="para">'),"",$answer);
		
		$data = array(
					'author'=>$author,
					'title'=>$title,
					'question'=>$question,
					'from'=>$from,
					'email'=>$email,
					'answer'=>$answer,
				);
		
		$this->helpMod->update($code,$data);
		redirect('just4u/help/');
	}
	
	function member_update(){
		$this->load->model("memberMod");
		$this->load->model("infoMemberMod");
		$this->load->model("contactMemberMod");
		
		$id = $this->uri->segment(3,0);
		/*
		 * member table
		 * $this->input->post("");
		 */
//		$username = $this->input->post("username");
//		$password = $this->input->post("password");
		$type = $this->input->post("type");
		$status = $this->input->post("status");
		$images_tmp = $_FILES['images']['tmp_name'];
		$images_type = $_FILES['images']['type'];
		$large_width = 600;
		$medium_width = 300;
		$small_width = 75;
		$name = $this->input->post("name");
		$birthday = $this->input->post('birthday');
		$place_of_birth = $this->input->post("place_of_birth");
		$gender = $this->input->post("gender");
		$address = $this->input->post("address");
		$phone1 = $this->input->post("phone1");
		$phone2 = $this->input->post("phone2");
		$email1 = $this->input->post("email1");
		$email2 = $this->input->post("email2");
		$website = $this->input->post("website");
		
		if($images_type=="" || $images_type==NULL){
			$data = array(
//						'username'=>$username,
//						'password'=>$password,
						'type'=>$type,
						'status'=>$status
					);
		} else {
			$data = array(
//						'username'=>$username,
//						'password'=>$password,
						'images_large'=>$this->images_large($images_tmp,$large_width,$name,$images_type),
						'images_medium'=>$this->images_medium($images_tmp,$medium_width,$name,$images_type),
						'images_small'=>$this->images_small($images_tmp,$small_width,$name,$images_type),
						'images_type'=>$images_type,
						'type'=>$type,
						'status'=>$status
					);
		}
		
		/*
		 * info table
		 */
		if($birthday==""){
			$data_info = array(
							'name'=>$name,
							'place_of_birth'=>$place_of_birth,
							'gender'=>$gender
						 );
		} else {
//			$birthday = date("Y-m-d",$this->input->post('birthday'));
			$data_info = array(
							'name'=>$name,
							'birthday'=>$birthday,
							'place_of_birth'=>$place_of_birth,
							'gender'=>$gender
						 );
		}
		
		/*
		 * contact table
		 */ 
		$data_contact = array(
							'address'=>$address,
							'phone1'=>$phone1,
							'phone2'=>$phone2,
							'email1'=>$email1,
							'email2'=>$email2,
							'website'=>$website
						);
		
		
		$this->memberMod->update($id,$data);
		$this->infoMemberMod->update($id,$data_info);
		$this->contactMemberMod->update($id,$data_contact);
		redirect('just4u/member/');
	}
	
	function make_cover(){
		$this->load->model("albumMod");
		$code = $this->uri->segment(3,0);
		$cover = $this->uri->segment(4,0);
		
		$data = array(
					'cover'=>$cover,
					);
		
		$this->albumMod->update($code,$data);
		return true;
	}
	
	function ImagesSmall(){
        $id = $this->uri->segment(4,0);
        $code = $this->uri->segment(3,0);
        switch($code){
        	case "news" 	: 	$this->load->model('newsMod');$query = $this->newsMod->get($id);break;
        	case "event" 	: 	$this->load->model('eventMod');$query = $this->eventMod->get($id);break;
        	case "download" : 	$this->load->model('downloadMod');$query = $this->downloadMod->get($id);break;
        	case "member" 	: 	$this->load->model('memberMod');$query = $this->memberMod->get($id);break;
        	case "edisi" 	: 	$this->load->model('edisiMod');$query = $this->edisiMod->get($id);break;
        	case "images" 	: 	$this->load->model('imagesMod');$query = $this->imagesMod->get($id);break;
        }
        $this->load->view('dashboard/admin/content/images_small',array('query'=>$query));        
    }
    
	function ImagesMedium(){
		$id = $this->uri->segment(4,0);
        $code = $this->uri->segment(3,0);
        switch($code){
        	case "news" 	: 	$this->load->model('newsMod');$query = $this->newsMod->get($id);break;
        	case "event" 	: 	$this->load->model('eventMod');$query = $this->eventMod->get($id);break;
        	case "download" : 	$this->load->model('downloadMod');$query = $this->downloadMod->get($id);break;
        	case "member" 	: 	$this->load->model('memberMod');$query = $this->memberMod->get($id);break;
        	case "edisi" 	: 	$this->load->model('edisiMod');$query = $this->edisiMod->get($id);break;
        	case "images" 	: 	$this->load->model('imagesMod');$query = $this->imagesMod->get($id);break;
        }
        $this->load->view('dashboard/admin/content/images_medium',array('query'=>$query));
    }
    
	function ImagesLarge(){
		$id = $this->uri->segment(4,0);
        $code = $this->uri->segment(3,0);
        switch($code){
        	case "news" 	: 	$this->load->model('newsMod');$query = $this->newsMod->get($id);break;
        	case "event" 	: 	$this->load->model('eventMod');$query = $this->eventMod->get($id);break;
        	case "download" : 	$this->load->model('downloadMod');$query = $this->downloadMod->get($id);break;
        	case "member" 	: 	$this->load->model('memberMod');$query = $this->memberMod->get($id);break;
        	case "edisi" 	: 	$this->load->model('edisiMod');$query = $this->edisiMod->get($id);break;
        	case "images" 	: 	$this->load->model('imagesMod');$query = $this->imagesMod->get($id);break;
        }
        $this->load->view('dashboard/admin/content/images_large',array('query'=>$query));
    }
	
}